home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d11
/
eganorm.arc
/
EGANORM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-05-03
|
4KB
|
144 lines
program EGAnorm;
{
By Rob Henningsgard, Compu$erve(76630,2145).
Thanks to Kent Cedola for GPPAL.P.
1) Places the EGA in textmode 3.
2) Sets the palette to defaults.
3) Returns altered cursor to normal settings.
By Rob Henningsgard, Compu$erve(76630,2145).
Written after considerable irritation at programs which sometimes 'forget'
to reset the cursor on terminating (like Xtree, for instance), or which
can't reset the EGA mode after aborting (like some of my Turbo Pascal
programs, for instance.)
The colors can be changed to provide a nonstandard system palette. A nice
example is to set Palette(0,
}
type
Palette_Array = array[0..15] of integer;
const
Black : integer = 0;
Blue : integer = 1;
Green : integer = 2;
Cyan : integer = 3;
Red : integer = 4;
Magenta : integer = 5;
Brown : integer = 6;
White : integer = 7;
Grey : integer = 56;
Light_Blue : integer = 57;
Light_Green : integer = 58;
Light_Cyan : integer = 59;
Light_Red : integer = 60;
Light_Magenta : integer = 61;
Yellow : integer = 62;
Bright_White : integer = 63;
var
I,J : integer;
Palette : Palette_Array;
procedure Set_EGA_Mode(m : byte);
var
regs : record
ax,bx,cx,dx,bp,di,si,ds,es,flags : integer
end;
begin
regs.ax := $0000 or m;
intr($10, regs)
end;
{ }
{ EGA Graphic Primitive for Turbo Pascal 3.01A, Version 01FEB86. }
{ (C) 1986 by Kent Cedola, 2015 Meadow Lake Ct., Norfolk, VA, 23518 }
{ }
{ Description: Set the EGA palette register(s). Warning: Palettes }
{ will be restored on a mode change (e.g., from text to graphics) }
{ }
procedure GPPAL(Palette,Color: Integer);
begin
inline
($8A/$5E/<Palette/$8A/$7E/<Color/$B8/$1000/$CD/$10);
end;
procedure Set_Cursor(Start_Line,End_Line : integer);
{
Sets the DOS cursor to the values specified.
}
type
Register_Record =
record case integer of
1 : (ax,bx,cx,dx,bp,si,di,ds,es,flags : integer);
2 : (al,ah,bl,bh,cl,ch,dl,dh : byte);
end;
var
Reg : Register_Record;
begin
Reg.ax := $0100;
Reg.bx := $0000;
Reg.cx := ((Start_Line and $FF) shl 8) or (End_Line and $FF);
Reg.dx := $0000;
Reg.ds := $0000;
intr($10,Reg);
end;
begin {EGAnorm}
Set_EGA_Mode(3);
if ParamCount < 1 then
begin
{
Set the normal defaults.
}
GPPAL(0,Black);{this is the default background}
GPPAL(1,Blue);
GPPAL(2,Green);
GPPAL(3,Cyan);
GPPAL(4,Red);
GPPAL(5,Magenta);
GPPAL(6,Brown);
GPPAL(7,White);{this is the default foreground}
GPPAL(8,Grey);
GPPAL(9,Light_Blue);
GPPAL(10,Light_Green);
GPPAL(11,Light_Cyan);
GPPAL(12,Light_Red);
GPPAL(13,Light_Magenta);
GPPAL(14,Yellow);
GPPAL(15,Bright_White);{this is the default highlight (?)}
end else begin
{
Set custom user colors.
}
GPPAL(0,Blue);
GPPAL(1,Black);
GPPAL(2,Green);
GPPAL(3,White);
GPPAL(4,Red);
GPPAL(5,Magenta);
GPPAL(6,Brown);
GPPAL(7,Bright_White);{this is the default foreground}
GPPAL(8,Grey);
GPPAL(9,Light_Blue);
GPPAL(10,Light_Green);
GPPAL(11,Light_Cyan);
GPPAL(12,Light_Red);
GPPAL(13,Light_Magenta);
GPPAL(14,Yellow);
GPPAL(15,Cyan);{this is the default highlight (?)}
end;
Set_Cursor(6,7);
end.